"""
@author: wy
@file: passwd_complexauth.py
@time: 2023/11/24 21:21
"""
import re

score = 2
password=input("please input your password:")

def isValidPasswd(passwd):
    str1 = []
    global score
    #1判断密码长度是否超过8
    if len(passwd)>=8:
        score += 1
    else:
        # return "长度小于8"
       str1 = ["长度小于8"]
    #2 判断有没有超过三种以上字符
    flag = flag1 = flag2 = flag3 = flag4 = 0
    for i in passwd:
        if i.isupper():
            flag1 = 1
        elif i.islower():
            flag2 = 1
        elif i.isdigit():
            flag3 = 1
        else:
            flag4 = 1

    if flag2+flag1+flag3+flag4 >=3:
        score+=1
    else:
        str1.append("密码没有由三种以上字符组成")
        # return "密码没有由三种以上字符组成"
    #3 判断是否有超过三个重复字符
    for i in range(len(passwd)):
        for j in range(3,len(passwd)):
            r = passwd[i:i+j]
            if re.search(r,passwd[i+j:]):
            # if passwd.count(r)>=2:
                str1.append("密码出现长度三以上重复的字符串")
                flag = 1
                break
    if flag == 0:
        score+=1
    return score,str1

#调用
print(isValidPasswd(password))

